package com.timk.goserver.client.compatibility;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * A Point.
 * @author TKington
 *
 */
public class Point implements IsSerializable {
	/** x coordinate */
	public int x;
	/** y coordinate */
	public int y;
	
	/** Just for serialization */
	public Point() { /* */ }
	
	/**
	 * Creates a point.
	 * @param x the x coordinate
	 * @param y the y coordinate
	 */
	public Point(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	/**
	 * Creates a copy of a point.
	 * @param point the point
	 */
	public Point(Point point) {
		this.x = point.x;
		this.y = point.y;
	}
	
	public boolean equals(Object obj) {
		Point point = (Point)obj;
		return point.x == x && point.y == y;
	}
	
	public int hashCode() {
		return (x << 5) + y;
	}

	public String toString() {
		return "(" + x + "," + y + ")";
	}
}
